import { request } from 'umi';

// 添加
export async function add(data) {
  return request('/api/menu', {
    method: 'POST',
    data: data,
  });
}

// 修改
export async function update(data) {
  return request('/api/menu', {
    method: 'PUT',
    data: data,
  });
}

// 查询菜单
export async function menulist() {
  return request('/api/menu/menulist', {
    method: 'GET',
  });
}

// 删除
export async function del(data) {
  return request(`/api/menu`, {
    method: 'DELETE',
    data: data,
  });
}

// 获取action 的分类
export async function actionclasslist() {
  return request('/api/menu/actionclasslist', {
    method: 'GET',
  });
}

//获取分类下的获取action
export async function actionlist(data) {
  return request('/api/menu/actionlist', {
    method: 'POST',
    data: data,
  });
}
//编辑菜单的action
export async function editmenubindingaction(data) {
  return request('/api/menu/editmenubindingaction', {
    method: 'POST',
    data: data,
  });
}

// 获取菜单绑定的 action
export async function menubindingaction(data) {
  return request(`/api/menu/menubindingaction/${data}`, {
    method: 'GET',
  });
}
